% TODO proof-reading
\subsection{switch()}

%The switch() statement is implemented with the \TT{tableswitch} instruction:
%
%
%\begin{lstlisting}[style=customjava]
%	public static void f(int a)
%	{
%		switch (a)
%		{
%		case 0: System.out.println("zero"); break;
%		case 1: System.out.println("one\n"); break;
%		case 2: System.out.println("two\n"); break;
%		case 3: System.out.println("three\n"); break;
%		case 4: System.out.println("four\n"); break;
%		default: System.out.println("something unknown\n"); break;
%		};
%	}
%\end{lstlisting}
%
%As simple, as possible:
%
%\begin{lstlisting}
%  public static void f(int);
%    flags: ACC_PUBLIC, ACC_STATIC
%    Code:
%      stack=2, locals=1, args_size=1
%         0: iload_0       
%         1: tableswitch   { // 0 to 4
%                       0: 36
%                       1: 47
%                       2: 58
%                       3: 69
%                       4: 80
%                 default: 91
%            }
%        36: getstatic     #2     // Field java/lang/System.out:Ljava/io/PrintStream;
%        39: ldc           #3     // String zero
%        41: invokevirtual #4     // Method java/io/PrintStream.println:(Ljava/lang/String;)V
%        44: goto          99
%        47: getstatic     #2     // Field java/lang/System.out:Ljava/io/PrintStream;
%        50: ldc           #5     // String one\n
%        52: invokevirtual #4     // Method java/io/PrintStream.println:(Ljava/lang/String;)V
%        55: goto          99
%        58: getstatic     #2     // Field java/lang/System.out:Ljava/io/PrintStream;
%        61: ldc           #6     // String two\n
%        63: invokevirtual #4     // Method java/io/PrintStream.println:(Ljava/lang/String;)V
%        66: goto          99
%        69: getstatic     #2     // Field java/lang/System.out:Ljava/io/PrintStream;
%        72: ldc           #7     // String three\n
%        74: invokevirtual #4     // Method java/io/PrintStream.println:(Ljava/lang/String;)V
%        77: goto          99
%        80: getstatic     #2     // Field java/lang/System.out:Ljava/io/PrintStream;
%        83: ldc           #8     // String four\n
%        85: invokevirtual #4     // Method java/io/PrintStream.println:(Ljava/lang/String;)V
%        88: goto          99
%        91: getstatic     #2     // Field java/lang/System.out:Ljava/io/PrintStream;
%        94: ldc           #9     // String something unknown\n
%        96: invokevirtual #4     // Method java/io/PrintStream.println:(Ljava/lang/String;)V
%        99: return        
%\end{lstlisting}
